{% extends 'admin/base.html'%}

{% block body%}
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header">
                    <h4>编辑菜单</h4>
                </div>
                <div class="card-body">
                    <form action="{{url_for('menu.edit', id=auth.id)}}" method="post" class="row" novalidate>
                        {{form.csrf_token}}
                        <div class="form-group col-md-12">
                            <label for="type">顶级菜单</label>
                            <div class="form-controls">
                                <select name="parent_id" id="" class="form-control">
                                    <option value="0" selected>顶级菜单</option>
                                    {% for m in menu%}
                                    <option value="{{m.id}}" {% if m.id==auth.parent_id%}selected{% endif %}>{{m.level | my_repeat}}{{m.name}}</option>
                                    {% endfor %}
                                </select>
                            </div>
                        </div>

                        <div class="form-group col-md-12">
                            <label for="title">{{form.name.label}}</label>
                            {{form.name(class='form-control')}}
                        </div>
                        {% for message in form.name.errors%}
                        <div class="form-group col-md-12" style="color: #f96868!important;">{{message}}</div>
                        {% endfor %}

                        <div class="form-group col-md-12">
                            <label for="seo_keywords">{{form.url.label}}</label>
                            {{form.url(class='form-control')}}
                        </div>
                        {% for message in form.url.errors%}
                        <div class="form-group col-md-12" style="color: #f96868!important;">{{message}}</div>
                        {% endfor %}

                        <div class="form-group col-md-12">
                            <label for="seo_keywords">{{form.sort.label}}</label>
                            {{form.sort(class='form-control', type="number")}}
                        </div>

                        <div class="form-group col-md-12">
                            <label for="status">菜单</label>
                            <div class="clearfix">
                                <label class="lyear-radio radio-inline radio-primary">
                                    <input type="radio" name="is_menu" value="1" {% if auth.is_menu==1%}checked{% endif %}><span>是</span>
                                </label>
                                <label class="lyear-radio radio-inline radio-primary">
                                    <input type="radio" name="is_menu" value="0" {% if auth.is_menu==0%}checked{% endif %}><span>否</span>
                                </label>
                            </div>
                        </div>

                        <div class="form-group col-md-12">
                            <label for="status">状态</label>
                            <div class="clearfix">
                                <label class="lyear-radio radio-inline radio-primary">
                                    <input type="radio" name="status" value="1" {% if auth.status==1%}checked{% endif %}><span>启用</span>
                                </label>
                                <label class="lyear-radio radio-inline radio-primary">
                                    <input type="radio" name="status" value="0" {% if auth.status==0%}checked{% endif %}><span>禁用</span>
                                </label>
                            </div>
                        </div>
                        <div class="form-group col-md-12">
                            {{form.submit(class='btn btn-primary')}}
                            <a class="btn btn-default" href="{{url_for('menu.index')}}">返 回</a>
                        </div>

                    </form>

                </div>
            </div>
        </div>

    </div>

</div>
{% endblock%}